package cn.sangyy;

import cn.sangyy.basic.interceptor.CarInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author SangYY
 * @date: 2023/04/23/15:06
 */
@SpringBootApplication
@MapperScan("cn.sangyy.*.mapper")
@ServletComponentScan("cn.sangyy.auth.listener")
public class CarStart implements WebMvcConfigurer {
    public static void main(String[] args) {
        SpringApplication.run(CarStart.class,args);
    }

    @Autowired
    private CarInterceptor carInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(carInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login/**","/user/phoneRegister/**","/user/phoneRegister/**",
                        "/user/bind/wechat/**","/shop/active/**",
                        "/txCos/**","/codeVerify/**");
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
